//
//  YDOAChargeDetialVC.swift
//  YDOAProduct
//
//  Created by YDWY on 2017/6/7.
//  Copyright © 2017年 Allen. All rights reserved.
//

import UIKit

class YDOAChargeDetialVC: UIViewController {

    
    
    var dataSoure : Array = Array<YDOAFreeModel>()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        self.title = "物资申请确认单"
        
        
        
        let scrollView = UIScrollView(frame: CGRect(x: 0, y: 64, width: ScreenWidth, height: ScreenHeight - 130))
        scrollView.backgroundColor = UIColor.white
        
        let userLab = UILabel.ym_lable(text: "申请人：曾诚", fontSize: 15, color: .black)
        userLab.frame = CGRect(x: 30, y: 20, width: ScreenWidth - 80, height: 21)
        scrollView.addSubview(userLab)
        
        
        let branchLab = UILabel.ym_lable(text: "申请部门: 信息中心", fontSize: 15, color: .black)
        branchLab.frame = CGRect(x: 30, y:userLab.ym_bottomY + 8 , width: ScreenWidth - 80, height: 21)
        scrollView.addSubview(branchLab)
        
        
        let goodsLab = UILabel.ym_lable(text: "申请费用：", fontSize: 15, color: .black)
        goodsLab.frame = CGRect(x: 30, y:branchLab.ym_bottomY + 8 , width: ScreenWidth - 80, height: 21)
        scrollView.addSubview(goodsLab)
        
        
        
        
        for i in 0..<dataSoure.count {
            let model = dataSoure[i]
            
            //理由
             let thingsLab = UILabel.ym_lable(text: "\(i).事宜：\(model.liyou)", fontSize: 15, color: .black)
             thingsLab.frame =  CGRect(x: 30, y: goodsLab.ym_bottomY + CGFloat(120 * i) + 8, width:ScreenWidth - 80 , height: 21)
            //金额
            let payCountLab = UILabel.ym_lable(text: "金额：\(model.payCount)元", fontSize: 15, color: .black)
            payCountLab.frame =  CGRect(x: 30, y: thingsLab.ym_bottomY + 8.0, width:ScreenWidth - 80 , height: 21)
            
            //科目
            let typeLab = UILabel.ym_lable(text: "科目：\(model.kemu)", fontSize: 15, color: .black)
            typeLab.frame =  CGRect(x: 30, y: payCountLab.ym_bottomY + 8.0, width:ScreenWidth - 80 , height: 21)
            
            //单据张数
            let danjuLab = UILabel.ym_lable(text: "单据张数：\(model.num)张", fontSize: 15, color: .black)
            danjuLab.frame =  CGRect(x: 30, y: typeLab.ym_bottomY + 8.0, width:ScreenWidth - 80 , height: 21)
            
            
            scrollView.addSubview(thingsLab)
            scrollView.addSubview(payCountLab)
            scrollView.addSubview(typeLab)
            scrollView.addSubview(danjuLab)
        }
        
        scrollView.contentSize = CGSize(width: ScreenWidth, height: 107.0 + 120.0 * CGFloat(dataSoure.count))
        
        view.addSubview(scrollView)
        
        
    }
    

    //确定申请

    @IBAction func sureApply(_ sender: Any) {
         navigationController?.pushViewController(YDOASucceedVC(), animated: true)
    }
    
   

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    
}
